/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.arguscab.ai.game;

import hu.arguscab.ai.FitnessFunction;
import hu.arguscab.ai.Model;
import hu.arguscab.game.ShipState;
import hu.arguscab.game.WorldState;

/**
 *
 * @author sharp
 */
public class FCollision extends FitnessFunction{

	@Override
	public float getMinValue() {
		return 0;
	}

	@Override
	public float getMaxValue() {
		return 1;
	}

	@Override
	public float calcF(Model m) {
		WorldState state = (WorldState)m.getState();
		ShipState shipState = state.getShipState();
		return shipState.isCollision() == true? 0 : 1;
	}

}
